﻿Public Class clsTaskTM
    Public Function insert(task_id As String, lhj As String, prod_id As String) As Integer
        Dim szSql As String
        Dim rtn As Integer
        DBacs.BeginTransaction()
        Try
            szSql = "insert into agv.task_tm(task_id,lhj,prod_id,status,update_time)"
            szSql &= " values (?, ?, ?, ?, (SELECT CURRENT_TIMESTAMP(6)))"
            rtn = DBacs.ExecuteUpdateSql(szSql, -1, task_id, lhj, prod_id, "待执行")
            szSql = "insert into agv.tmj(task_id,prod_id,update_time)"
            szSql &= " values (?, ?, (SELECT CURRENT_TIMESTAMP(6)))"
            rtn = DBacs.ExecuteUpdateSql(szSql, -1, task_id, prod_id)
            DBacs.CommitTransaction()
        Catch ex As Exception
            DBacs.RollbackTransaction()
            rtn = -2
        End Try

        Return rtn
    End Function

    Public Function getList(prod_id As String) As DataTable
        Dim szSql As String = "SELECT * FROM agv.task_tm WHERE 1 = 1 and prod_id = ? "
        Return DBacs.ExecuteSql(szSql, -1, prod_id)
    End Function
End Class
